package com.huawei.appmarket.service.appdetail.view.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.RelativeLayout;

import o.Logger;
import o.ewm.d;

public class DetailRelativeLayout extends RelativeLayout {
    private int ˊ;
    private int ˋ;
    private int ˏ;
    private int ॱ;

    public DetailRelativeLayout(Context context) {
        super(context);
        ˊ();
    }

    public DetailRelativeLayout(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        ˊ();
    }

    public DetailRelativeLayout(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        ˊ();
    }

    private void ˊ() {
        this.ॱ = Math.round(getResources().getDimension(d.ˏ));
        this.ˏ = Math.round(getResources().getDimension(d.ˎ));
    }

    protected void onMeasure(int i, int i2) {
        super.onMeasure(i, i2);
        if (getChildCount() == 3) {
            View childAt = getChildAt(0);
            View childAt2 = getChildAt(1);
            View childAt3 = getChildAt(2);
            int measuredWidth = childAt.getMeasuredWidth();
            int measuredWidth2 = childAt2.getMeasuredWidth();
            int measuredWidth3 = childAt3.getMeasuredWidth();
            if ((childAt3 instanceof FrameLayout) && measuredWidth3 > this.ॱ) {
                if (measuredWidth != this.ˋ || measuredWidth2 != this.ˊ) {
                    this.ˋ = measuredWidth;
                    this.ˊ = measuredWidth2;
                    try {
                        measuredWidth = ((((getMeasuredWidth() - measuredWidth) - measuredWidth2) - this.ॱ) - (this.ˏ * 2)) / 2;
                        LayoutParams layoutParams = (LayoutParams) childAt.getLayoutParams();
                        layoutParams.setMarginStart(measuredWidth);
                        layoutParams.setMarginEnd(this.ˏ);
                        childAt.setLayoutParams(layoutParams);
                        layoutParams = (LayoutParams) childAt2.getLayoutParams();
                        layoutParams.setMarginStart(this.ˏ);
                        layoutParams.setMarginEnd(measuredWidth);
                        childAt2.setLayoutParams(layoutParams);
                    } catch (Throwable e) {
                        Logger.ˋ("DetailRelativeLayout", "onMeasure", e);
                    }
                }
            }
        }
    }
}
